package com.bblocks.common.anti_reptile.demo.userId;

import com.bblocks.common.anti_reptile.interceptor.AbstractAntiInterceptor;
import org.springframework.stereotype.Component;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * <p>Project: bb-anti-reptile - UserAntiInterceptor</p>
 * <p>描述：演示用 用户信息处理</p>
 *
 * @Author Zhao [125043150@qq.com]
 * @Date 2024/4/2 12:00
 * @Version 1.0
 * @since 8
 */
@Component
public class UserAntiInterceptor extends AbstractAntiInterceptor {
    @Override
    public boolean doPreHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
        String token = request.getHeader("token");
        request.setAttribute("UserId","1");
        return true;
    }

    @Override
    public int getOrder() {
        return 0;
    }
}
